<script setup>
import { Setting, HomeFilled, Menu, School } from "@element-plus/icons-vue";
const handleOpen = (key, keyPath) => {
  console.log(key, keyPath);
};
const handleClose = (key, keyPath) => {
  console.log(key, keyPath);
};
</script>

<template>
  <el-container class="app-layout">
    <el-aside width="200px" class="app-side">
      <div class="logo">
        <span>ADMIN UI</span>
      </div>
      <el-menu
        default-active="/home"
        class="side-menu"
        @open="handleOpen"
        @close="handleClose"
        router
      >
        <el-menu-item index="/home">
          <el-icon>
            <HomeFilled />
          </el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-sub-menu index="/system">
          <template #title>
            <el-icon>
              <Setting />
            </el-icon>
            <span>系统管理</span>
          </template>
          <el-menu-item index="/system/user">
            <el-icon>
              <Menu />
            </el-icon>
            <span>用户管理</span>
          </el-menu-item>
          <el-menu-item index="/system/role">
            <el-icon>
              <Menu />
            </el-icon>
            <span>角色管理</span>
          </el-menu-item>
          <el-menu-item index="/system/permission">
            <el-icon>
              <Menu />
            </el-icon>
            <span>权限管理</span>
          </el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="/campus">
          <template #title>
            <el-icon>
              <School />
            </el-icon>
            <span>校园管理</span>
          </template>
          <el-menu-item index="/campus/class">
            <el-icon>
              <Menu />
            </el-icon>
            <span>班级管理</span>
          </el-menu-item>
          <el-menu-item index="/campus/student">
            <el-icon>
              <Menu />
            </el-icon>
            <span>学生管理</span>
          </el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>
    <el-container class="app-cent-container">
      <el-header class="app-header">Header</el-header>
      <el-main class="app-content">
        <div class="content-wrapper">
          <router-view></router-view>
        </div>
      </el-main>
    </el-container>
  </el-container>
</template>

<style lang="less" scoped>
.app-layout {
  height: 100vh;
  background-color: #f0f2f5;

  .app-side {
    background-color: #fff;
    box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
    position: relative;
    z-index: 10;

    .logo {
      height: 64px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 24px;
      overflow: hidden;

      span {
        color: #0c0c0c;
        font-size: 18px;
        font-weight: 600;
        white-space: nowrap;
      }
    }

    .side-menu {
      border-right: none;
    }
  }

  .app-cent-container {
    position: fixed;
    top: 0;
    left: 200px;
    right: 0;
    bottom: 0;
    background-color: #f9f9f9;

    .app-header {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      height: 64px;
      background: #fff;
      padding-left: 16px;
      padding-right: 16px;
      line-height: 64px;
      align-items: center;
      border-bottom: 1px solid #d8dce5;
    }

    .app-content {
      display: flex;
      flex-direction: column;
      position: absolute;
      top: 104px;
      right: 20px;
      bottom: 20px;
      left: 20px;
      background-color: #fff;
    }
  }

  .app-footer {
    text-align: center;
    padding: 16px 24px;
    color: rgba(0, 0, 0, 0.45);
    font-size: 14px;
    background: #fff;

    .footer-links {
      margin-bottom: 8px;

      a {
        color: rgba(0, 0, 0, 0.45);
        margin: 0 8px;

        &:hover {
          color: rgba(0, 0, 0, 0.65);
        }
      }
    }
  }
}
</style>
